﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.crew {
    import flash.utils.*;
    import Classes.*;

    public class CrewMap {

        private var m_crewMap:Dictionary;

        public function CrewMap(){
            this.m_crewMap = new Dictionary();
        }
        public function cleanUp():void{
            var _local1:Object;
            var _local2:Crew;
            if (this.m_crewMap){
                for (_local1 in this.m_crewMap) {
                    _local2 = (this.m_crewMap[_local1] as Crew);
                    if (_local2){
                        _local2.cleanUp();
                    };
                    delete this.m_crewMap[_local1];
                };
            };
            this.m_crewMap = null;
        }
        public function loadObject(_arg1:Object):void{
            var _local2:String;
            var _local3:Object;
            var _local4:Crew;
            for (_local2 in _arg1) {
                _local3 = _arg1[_local2];
                _local4 = new Crew();
                _local4.loadObject(_local3);
                this.m_crewMap[_local2] = _local4;
            };
        }
        public function getCrewByObject(_arg1:GameObject):Crew{
            return (this.getCrewById(_arg1.getId()));
        }
        public function getCrewById(_arg1:Number):Crew{
            return ((this.m_crewMap[_arg1] as Crew));
        }
        public function getCrewCountById(_arg1:Number):int{
            var _local2:Crew = this.getCrewById(_arg1);
            return ((_local2) ? _local2.count : 0);
        }
        public function getCrewCountByObject(_arg1:GameObject):int{
            return (this.getCrewCountById(_arg1.getId()));
        }
        public function addCrewById(_arg1:Number, _arg2:String):void{
            var _local4:Crew;
            var _local3:Crew = this.getCrewById(_arg1);
            if (_local3){
                _local3.add(_arg2);
            } else {
                _local4 = new Crew();
                _local4.add(_arg2);
                this.m_crewMap[_arg1] = _local4;
            };
        }
        public function addCrewByObject(_arg1:GameObject, _arg2:String):void{
            this.addCrewById(_arg1.getId(), _arg2);
        }

    }
}//package Modules.crew 
